10 REM ***** This is a short program to demonstrate the menu routine 100 ON 10000 REM ***** A seemingly trivial routine follows, yet I have used it 10010 REM ***** in every program I have written. It reads the mouse and 10020 REM ***** keyboard, returning the following when a key is pressed: 10030 REM ***** I$ : ASCII character of key, GS : ST scancode of key 10040 REM ***** MK : mouse key pressed, MX,MY : coords of mouse 10050 REM ***** ZM : zone the mouse is in 10060 VARNAME 10070 REPEAT 10080 VARNAME 10090 RETURN 110 REPEAT 120 FADE 130 UNTIL 140 DEFAULT 150 DATA 160 DATA 170 DATA 180 DATA 20 REM ***** It is written by and copyright 1990,91 Philip Rankin 30 REM ***** You are free to use the menu and appearroutine if you so wish 40 KEY 4000 REM ***** Block appear - see Early Learning Maths title screen 4010 VARNAME 4020 REPEAT 4030 SCREEN COPY 4040 VARNAME 4050 UNTIL 4060 SCREEN COPY 4100 REM ***** roll picture onto screen as in ST News 4.4 and Ballistix 4110 FOR 4120 FOR 4130 SCREEN COPY 4140 SCREEN COPY 4150 SCREEN COPY 4160 SCREEN COPY 4170 WAIT VBL 4180 SCREEN COPY 4190 RETURN 4300 REM ***** another fairly simple appear 4320 GET PALETTE 4330 FOR 4340 FOR 4350 SCREEN COPY 4360 SCREEN COPY 4370 WAIT VBL 4380 SCREEN COPY 4400 REM ***** Roll the picture down the screen as if it is peeling off the bar 4420 GET PALETTE 4430 FOR 4440 FOR 4450 SCREEN COPY 4460 SCREEN COPY 4470 SCREEN COPY 4480 WAIT VBL 4490 SCREEN COPY 4500 REM ***** 'Pour' appear - pours picture onto screen 4530 FOR 4540 SCREEN COPY 4550 WAIT VBL 4560 SCREEN COPY 4570 RETURN 4600 REM ***** shows a screen, stored in bank 15 plane by plane - version 1 4610 FOR 4620 VARNAME 4630 FOR 4640 NEXT 4650 SCREEN COPY 4700 REM ***** shows a screen, stored in bank 15 plane by plane - version 2 4710 FOR 4720 VARNAME 4730 FOR 4740 NEXT 4750 SCREEN COPY 5 REM Checked GFF ¿ 50 DIM 5000 REM ***** This routine provides a simple menu 5010 REM ***** You can have as many options on the menu as will fit on the 5020 REM ***** screen. It requires the following variables 5030 REM ***** OPTION$() : an array holding all the menu options 5040 REM ***** WHERE : a pointer to first line of data holding options 5050 REM ***** N_ITEMS : the number of options in the menu 5060 REM ***** IX : the x_coord of first option 5070 REM ***** IY : the y_coord of first option 5080 REM ***** It returns the chosen option in the variable CURR_POS 5090 REM ***** EG: 10 WHERE=60000:N_ITEMS=10:IX=0:IY=0:gosub 5000 5095 REM ***** NOTE: THIS ROUTINE MAKES USE OF MY KEYBOARD/MOUSE INPUT ROUTINE 5100 VARNAME 5110 VARNAME 5120 REM ***** the above are constants, -- easier to understand than numbers 5130 GOSUB 5140 GOSUB 5150 REM ***** Now the main Loop: Use arrows to move to option 5160 REM ***** and return to select it 5170 WHILE 5180 VARNAME 5190 REPEAT 5210 VARNAME 5220 IF 5230 IF 5240 IF 5250 IF 5260 IF 5270 IF 5280 WEND 5285 RETURN 5290 REM ***** display the menu 5300 FOR 5310 LOCATE 5320 NEXT 5330 RETURN 5340 REM ***** invert the current option 5350 LOCATE 5360 INVERSE 5370 LOCATE 5380 INVERSE 5390 RETURN 5400 REM ***** Read in and Process the option$() so all options are same length 5410 RESTORE 5420 FOR 5430 READ 5440 IF 5450 NEXT 5460 FOR 5470 VARNAME 5480 NEXT 5490 RETURN 60 FADE 61 REPEAT 62 FADE 80 HIDE 82 PEN 84 PEN 85 PEN 86 PEN 88 REM ***** call the menu routine 90 PEN 95 FADE